<!--包含头部文件-->
{include file="public/head"}
<!--支付第一步-->
<div class="firstly">
    <div class="bindmobile-wrap">
        采用<span style="color:red">微信支付</span>，购买成功后，团购券将发到您的注册邮箱：<span class="mobile">{$user->email}</span><a
            class="link"></a>
    </div>

    <table class="table table-goods" cellpadding="0" cellspacing="0">
        <tbody>
        <tr>
            <th class="first">商品</th>
            <th width="120">单价</th>
            <th width="190">数量</th>
            <th width="140" class="last">小计</th>
        </tr>
        <tr class="j-row">
            <td class="vtop">
                <div class="title-area" title="{$deal.name}">
                    <div class="img-wrap">
                        <a href="" target="_blank"><img src=""></a>
                    </div>
                    <div class="title-wrap">
                        <div class="title">
                            <a href="" class="link">{$deal.name}</a>
                        </div>
                        <div class="attrs"></div>
                    </div>
                </div>
            </td>
            <td>￥<span class="font14">{$deal.current_price}</span></td>
            <td class="j-cell">
                <div class="buycount-ctrl">
                    <a class="j-ctrl ctrl minus disabled"><span class="horizontal"></span></a>
                    <input type="text" value="{$count}" maxlength="10">
                    <a class="ctrl j-ctrl plus"><span class="horizontal"></span><span class="vertical"></span></a>
                </div>
                <span class="err-wrap j-err-wrap"></span>
            </td>
            <td class="price font14">¥<span class="j-sumPrice">{$deal.current_price*$count}</span></td>
        </tr>
        </tbody>
    </table>

    <hr>

    <div class="final-price-area">应付总额：
        <span class="sum">￥
            <span class="price">{$deal.current_price*$count}
            </span>
        </span>
    </div>

    <div class="page-button-wrap">
        <a class="o2o_pay btn btn-primary">确认</a>
    </div>

    <div style="width: 100%;min-width: 1200px;height: 5px;background: #dbdbdb;margin: 50px 0 20px;"></div>
</div>


<div class="footer">
    <ul class="first">

    </ul>
    <ul class="second">

    </ul>
</div>

<script>
    //校验正整数
    function isNaN(number) {
        var reg = /^[1-9]\d*$/;
        return reg.test(number);
    }

    function inputChange(num) {
        if (!isNaN(num)) {
            $(".buycount-ctrl input").val("1");
        } else {
            $(".buycount-ctrl input").val(num);
            $(".j-sumPrice").text($("td .font14").text() * num - $(".j-cellActivity span").text());
            $(".sum .price").text($("td .font14").text() * num - $(".j-cellActivity span").text());
            if (num == 1) {
                $(".buycount-ctrl a").eq(0).addClass("disabled");
            } else {
                $(".buycount-ctrl a").eq(0).removeClass("disabled");
            }
        }
    }

    $(".buycount-ctrl input").keyup(function () {
        var num = $(".buycount-ctrl input").val();
        inputChange(num);
    });
    $(".minus").click(function () {
        var num = $(".buycount-ctrl input").val();
        num--;
        inputChange(num);
    });
    $(".plus").click(function () {
        var num = $(".buycount-ctrl input").val();
        num++;
        inputChange(num);
    });

    $(".o2o_pay").click(function () {
        var count = $(".buycount-ctrl input").val();
        var price = $(".sum .price ").text();
       url = "{:url('order/index',['id'=>$deal.id])}"+"&deal_count="+count+"&total_price="+price;
       self.location=url;
    });

</script>
</body>
</html>